// import '@vue-office/excel/lib/index.css';

// import vueOfficeExcel from '@vue-office/excel';
import { defineComponent, Ref, ref } from 'vue';

import { request } from '@/utils/request';

export default defineComponent({
  props: {
    api: {
      type: String,
      default: '/api/admin/systemUser/getExpenseExcel',
    },
    param: {
      type: Object,
      default: () => {
        return {
          num: 10,
          page: 1,
          search: '',
        };
      },
    },
  },
  setup(props) {
    const getFile = async () => {
      try {
        const result = await request.post(
          {
            url: props.api,
            data: props.param,
            responseType: 'blob',
          },
          { isTransformResponse: false },
        );
        // result.arrayBuffer().then((res) => {
        //   excelFile.value = res;
        // });
      } catch (error) {
        console.error(error);
      }
    };

    const excelFile = ref<Ref>(null);

    return () => (
      <>
        <t-button onClick={getFile}>123123</t-button>;
        {/* <vue-office-excel src={excelFile.value} style="height: 100vh;" /> */}
      </>
    );
  },
});
